package cn.huoyingkeji.common.service;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import cn.huoyingkeji.common.domain.TreeDTO;

public interface TreeBaseService<D extends TreeDTO> extends BaseService<D>{

    default List<D> toTree(List<D> dtos){
        Set<Long> parentIds = dtos.stream().map(D::getParentId).collect(Collectors.toSet());
        if(null == parentIds || parentIds.size()==0){
            return dtos;
        }else{
            return null;
        }
    }
}
